home *** CD-ROM | disk | FTP | other *** search
/ Just Call Me Internet / Just Call Me Internet.iso / prog / mint / netlib / lib / herror.c < prev    next >
Encoding:
C/C++ Source or Header  |  1994-12-27  |  644 b   |  31 lines

  1. /*
  2.  * herror() for Mint-Net, (w) 1994, Kay Roemer.
  3.  */
  4.  
  5. #include "socklib.h"
  6. #include <sys/types.h>
  7. #include <netdb.h>
  8. #include <stdio.h>
  9.  
  10. char    *h_errlist[] = {
  11.     "Error 0",
  12.     "Unknown host",                /* 1 HOST_NOT_FOUND */
  13.     "Host name lookup failure",        /* 2 TRY_AGAIN */
  14.     "Unknown server error",            /* 3 NO_RECOVERY */
  15.     "No address associated with name",    /* 4 NO_ADDRESS */
  16. };
  17. int    h_nerr = { sizeof (h_errlist)/sizeof (h_errlist[0]) };
  18.  
  19. extern int    h_errno;
  20.  
  21. void
  22. herror (s)
  23.     const char *s;
  24. {
  25.     fprintf (stderr, "%s: %s.\n",
  26.         (s && *s) ? s : "",
  27.         ((u_int)h_errno < h_nerr)
  28.             ? h_errlist[h_errno]
  29.             : "Unknown error");
  30. }
  31.